#!/bin/bash

floders=$(ls ${1}/)
pre_dir=$2
k=$3
for floder in $floders; do
    files=$(ls ${1}/${floder}/)

    for file in $files; do
        input="${1}/${floder}/${file}"

	pre_file="$2/$floder/$file-k$k.clq"
	pre_jdg=$(grep "^c pre_LB" $pre_file)
	if [ -z "$pre_jdg" ]; then
	    echo ""	
	    time1=$(date)
	    echo ${time1}
	    echo "timeout 14400 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800"
	    timeout 14400 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800
	fi
     done
done
